[aliases]
n0=;       The following sections deal with userlist maintenance
n1=;       I wouldn't recommend modifying anything here unless you know this
n2=;       script better than I do...  I try to avoid modifying it as much as possible
n3=;       myself, and I wrote it!
n4=;
n5=;       Don't do it!!!
n6=;
n7=deopdevoice {
n8=  if $me isop $1 {
n9=    if $2 isop $1 mode $1 -o $2
n10=    elseif $2 isvo $1 mode $1 -v $2
n11=  }
n12=}
n13=add {
n14=  ; add nick $1 (address $2) to $3 (numeric level 15-60) list
n15=  ; $4 is the nick $1 is currently using
n16=  if $3 = 15 {
n17=    if (%usespecific) deopdevoice %addchan $4
n18=    else {
n19=      %i = 0
n20=      :nx
n21=      inc %i
n22=      deopdevoice $chan(%i) $4         
n23=    }
n24=  }
n25=  set %nick $replace($1,[,|) | set %nick $replace(%nick,],|) | unset %modified
n26=  if $1 = $me { altech -a %dis6 $+ You do not need to add yourself to your userlist! | dh }
n27=  if $2 iswm %myadr  { altech -a %dis6 $+ %nick appears to be your clone. | altech -a %dis6 $+ You do not need to add yourself to your userlist! | dh }
n28=  set %temp $readini $ul address [ [ %nick ] $+ 1 ]
n29=  set %lv $level($maddress($2)) | unset %newlevel
n30=  if ((%temp != $null) && (%lv < 14)) {
n31=    altech -a %dis7 $+ %nick is a recognized nick, but I don't know this hostmask.
n32=    altech -a %dis8 $+ Attempting to add current hostmask... | addhost %nick $2 | set %modified $true
n33=    set %newlevel $level($2)
n34=  }
n35=  if ((%temp = $null) && (%lv > 14)) {
n36=    altech -a %dis7 $+ I recognize the address, but I don't know the nick %nick $+ .
n37=    altech -a %dis8 $+ Proceeding to change the recognized nick...
n38=    chnick %nick $2 | set %modified $true
n39=  }
n40=  if ((%lv != $3) && (%lv > 14)) {
n41=    altech -a %dis8 $+ Proceeding to change levels for %nick
n42=    chlv %nick $2 $3 | set %modified $true
n43=  }
n44=  if ((%level != $3) && (%newlevel > 14)) {
n45=    altech -a %dis8 $+ Proceeding to change levels for %nick
n46=    chlv %nick $2 $3 | set %modified $true
n47=  }
n48=  set %realnick $rnick.ady($2)
n49=  if (%modified) {
n50=    set %realnick $rnick.ady($2)
n51=    set %chans $readini $ul channels %realnick
n52=    if %chans = $null {
n53=      if %addchan != $null { 
n54=        writeini $ul channels %realnick %addchan
n55=        if (%usespecific) altech -a %dis9 $+ Added %addchan to channel list for %nick
n56=      }
n57=    }
n58=    elseif %addchan !isin %chans {
n59=      if %addchan != $null {
n60=        writeini $ul channels %realnick %chans %addchan
n61=        if (%usespecific) altech -a %dis9 $+ Added %addchan to channel list for %nick
n62=      }
n63=    }
n64=    altech -a %dis9 $+ Finished updating info for $1 | dh
n65=  }
n66=  if %realnick != $null {
n67=    set %chans $readini $ul channels %realnick
n68=    if %chans = $null {
n69=      if %addchan != $null {
n70=        writeini $ul channels %realnick %addchan
n71=        if (%usespecific) altech -a %dis9 $+ Added %addchan to channel list for %nick
n72=        else altech -a %dis7 $+ $1 is already found in your $wordlist($3) list with this address!
n73=      }
n74=      else altech -a %dis7 $+ $1 is already found in your $wordlist($3) list with this address!
n75=    }
n76=    elseif (%addchan !isin %chans) {
n77=      if (%addchan != $null) {
n78=        writeini $ul channels %realnick %chans %addchan
n79=        if (%usespecific) altech -a %dis9 $+ Added %addchan to channel list for %nick
n80=        else altech -a %dis7 $+ $1 is already found in your $wordlist($3) list with this address!
n81=      }
n82=      else altech -a %dis7 $+ $1 is already found in your $wordlist($3) list with this address!
n83=    }
n84=    elseif ((%usespecific) && (%addchan != $null)) altech -a %dis7 $+ $1 is already in your $wordlist($3) list on %addchan $+ !
n85=    else altech -a %dis7 $+ $1 is already in your $wordlist($3) list with this address!
n86=    dh
n87=  }
n88=  .auser $3 $2
n89=  writeini $ul level %nick $3
n90=  writeini $ul address [ %nick $+ 1 ] $2
n91=  writeini $ul nick $2 %nick
n92=  set %num $readini $ul nicklist number
n93=  writeini $ul nicklist [ n $+ [ %num ] ] %nick
n94=  inc %num | writeini $ul nicklist number %num
n95=  writeini $ul seen %nick $ctime
n96=  if %addchan != $null writeini $ul channels %nick %addchan
n97=  if (%usespecific) altech -a %dis6 $+ Added %nick ( $+ $2 $+ ) $wordlist($3) list on %addchan
n98=  else altech -a %dis6 $+ Added %nick ( $+ $2 $+ ) to $wordlist($3) list
n99=  alert
n100=}
n101=remove {
n102=  if ($a5($1) != $null) ru $1 $a5($1)
n103=  else {
n104=    altech -a $dis7 $+ $1 is not in the internal address list | altech -a %dis8 $+ Attempting alternate removal
n105=    set %remnick $1 | .enable #altrem | userhost $1
n106=  }
n107=}
n108=ru {
n109=  ; remove nick $1 (address $2) from user list
n110=  if $1 = $me { altech -a %dis7 $+ You cannot remove yourself from your user list! | dh }
n111=  if $mask($2,3) iswm %myadr { altech -a %dis7 $+ $1 appears to be your clone.  Cannot Remove! | dh }
n112=  set %nick $rnick.ady($2)
n113=  if %nick = $null { altech -a %dis7 $+ $1 is not in your userlist | dh }
n114=  %ac = 0
n115=  :nx
n116=  inc %ac
n117=  set %remove $readini $ul address [ [ %nick ] $+ [ %ac ] ]
n118=  if %remove != $null {
n119=    remini $ul nick %remove
n120=    remini $ul address [ [ %nick ] $+ [ %ac ] ]
n121=    .ruser %remove | altech -a %dis8 $+ Removing %remove
n122=    goto nx
n123=  }
n124=  dec %ac
n125=  remlist %nick
n126=  remini $ul channels %nick | remini $ul seen %nick
n127=  remini $ul level %nick | remini $ul password %nick
n128=  altech -a %dis9 $+ Removed $1 from all lists!
n129=  if %nick != $1 altech -a %dis9 $+ ( $+ $1 was really %nick $+ ) | alert
n130=}
n131=addhost {
n132=  ; add hostmask $2 to nick $1
n133=  if $2 = $null { altech -a %dis7 $+ Cannot determine an address for $1 $+ .  Cannot add hostmask. | dh }
n134=  set %level $readini $ul level $1
n135=  if %level = $null { altech -a %dis7 $+ $1 is not in your userlist! | dh }
n136=  set %othernick $rnick.ady($2)
n137=  if ((%othernick != $null) && (%othernick != $1)) altech -a %dis7 $+ Warning! %dis8 $2 is already a known address for %othernick (adding anyway)
n138=  .auser %level $2
n139=  writeini $ul nick $2 $1
n140=  %ac = 0
n141=  :nx
n142=  inc %ac
n143=  set %temp $readini $ul address [ [ $1 ] $+ [ %ac ] ]
n144=  if %temp != $null goto nx
n145=  writeini $ul address [ [ $1 ] $+ [ %ac ] ] $2
n146=  altech -a %dis9 $+ Added $2 to %nick
n147=}
n148=chlv {
n149=  ; change nick $1 (address $2) to level $3 (numeric level 20-60)
n150=  if $1 = $me { altech -a %dis7 $+ You do not need to change your level! | dh }
n151=  set %nick $rnick.ady($2)
n152=  if %nick = $null { altech -a %dis7 $+ $1 is not in your userlist! | dh }
n153=  %ac = 0
n154=  :nx
n155=  inc %ac
n156=  set %change $readini $ul address [ [ %nick ] $+ [ %ac ] ]
n157=  if %change != $null {
n158=    .auser $3 %change | altech -a %dis8 $+ Changing %change
n159=    goto nx
n160=  }
n161=  writeini $ul level %nick $3
n162=  dec %ac
n163=  altech -a %dis8 $+ Changed %ac address(es)
n164=  altech -a %dis9 $+ $1 is now in $wordlist($3) list
n165=}
n166=chnick {
n167=  ; change address $2 to nick $1
n168=  set %nk2 $rnick.ady($2)
n169=  set %level $readini $ul level %nk2
n170=  if ((%nk2 = $null) || (%level = $null)) { altech -a %dis7 $+ $1 ( $+ $2 $+ ) is not in your user list. | dh }
n171=  %ac = 0
n172=  :nx
n173=  inc %ac
n174=  set %change $readini $ul address [ [ %nk2 ] $+ [ %ac ] ]
n175=  if %change != $null {
n176=    remini $ul address [ [ %nk2 ] $+ [ %ac ] ]
n177=    writeini $ul address [ [ $1 ] $+ [ %ac ] ] %change
n178=    writeini $ul nick %change $1
n179=    altech -a %dis8 $+ Changing %change
n180=    goto nx
n181=  }
n182=  dec %ac
n183=  remini $ul level %nk2 | writeini $ul level $1 %level
n184=  set %chans $readini $ul channels %nk2
n185=  if %chans != $null { 
n186=    writeini $ul channels $1 %chans
n187=    remini $ul channels %nk2
n188=  }
n189=  remini $ul seen %nk2 | writeini $ul seen $1 $ctime
n190=  set %num $readini $ul nicklist number
n191=  writeini $ul nicklist [ n $+ [ %num ] ] $1
n192=  inc %num | writeini $ul nicklist number %num
n193=  remlist %nk2
n194=  altech -a %dis9 $+ %nk2 is now known as $1
n195=}
n196=gk set %nk $readini $ul nicklist [ n $+ [ $1 ] ]
n197=gn inc %l | gk %l
n198=fp {
n199=  :nx
n200=  gn | if %nk = $1 return %l
n201=  if %l < %num goto nx
n202=  return -1
n203=}
n204=remlist {
n205=  ; remove nick $1 from the [nicklist] part of userlist.ini
n206=  set %num $readini $ul nicklist number | if %num = $null goto done
n207=  %l = -1 | dec %num | set %rt $fp($1)
n208=  if %rt = -1 goto done
n209=  :nx
n210=  if %rt = %num { remini $ul nicklist [ n $+ [ %rt ] ] | writeini $ul nicklist number %num | goto done }
n211=  %rn = %rt + 1 | gk %rn
n212=  writeini $ul nicklist [ n $+ [ %rt ] ] %nk | inc %rt | goto nx
n213=  :done
n214=}
n215=convert {
n216=  set %ady $replace($1,!~,!)
n217=  if ix.netcom.com isin %ady return $replace( [ $mask(%ady,3) ] ,*.ix.netcom.com, [ $mid(5,6, [ $mask(%ady,2) ] ) ] ) $+ *.ix.netcom.com
n218=  else {
n219=    %k = 0
n220=    :nx
n221=    inc %k
n222=    set %dom %dom [ $+ [ %k ] ]
n223=    if (%dom != $null) {
n224=      if %dom isin %ady {
n225=        set %sw 3 | set %adr *!*
n226=        :nw
n227=        inc %sw | set %adr %adr $+ $mid(%sw,1,$mask(%ady,3))
n228=        if $mid(%sw,1,$mask(%ady,3)) != @ goto nw
n229=        return %adr $+ *. $+ %dom
n230=      }
n231=      goto nx
n232=    }
n233=  }
n234=  return $mask(%ady,3)
n235=}
n236=addban {
n237=  ; add mask $1 to ban list on $2 using reason $3
n238=  ; $2 = "global" if no channel is specified
n239=  if $al($1) = 10 {
n240=    set %chans $readini $ul whereban $m($1)
n241=    if ((%chans = $null) && ($2 = global)) { altech -a %dis7 $+ $1 is already in your ban list! (Maybe you should try activating it!) | dh }
n242=    elseif (($2 isin %chans) && ($2 != global)) { altech -a %dis7 $+ $1 is already in your ban list on $2 $+ ! (Maybe you should try activating it!) | dh }
n243=    elseif ((%chans != $null) && ($2 = global)) {
n244=      altech -a %dis7 $+ Making ban on $m($1) a global ban
n245=      remini $ul whereban $m($1)
n246=      newreason $1 $3- | dh
n247=    }
n248=    elseif ((%chans != $null) && ($2 !isin %chans) && ($2 != global)) {
n249=      altech -a %dis7 $+ Adding $2 to list of banned channels for $1
n250=      writeini $ul whereban $m($1) %chans $2
n251=      newreason $1 $3- | dh
n252=    }
n253=    elseif ((%chans = $null) && ($2 != global)) {
n254=      altech -a %dis7 $+ Making ban on $m($1) specific to $2
n255=      writeini $ul whereban $m($1) $2
n256=      newreason $1 $3- | dh
n257=    }
n258=  }
n259=  if $1 iswm %myadr { altech -a %dis7 $+ Duh, hey Marge... I think I'll ban myself today | altech -a %dis8 $+ $1 matches your address, procedure Aborted! | dh }
n260=  .auser 10 $1 | set %nb $readini $ul bans number
n261=  inc %nb | writeini $ul bans [ n $+ [ %nb ] ] $1
n262=  writeini $ul bans number %nb
n263=  if $3 != $null writeini $ul whyban $1 $3-
n264=  writeini $ul created $1 $adate $rtime
n265=  if $2 = global altech -a %dis9 $+ Added $1 to your global ban list
n266=  else {
n267=    writeini $ul whereban $1 $2
n268=    altech -a %dis9 $+ Added $1 to your ban list on $2
n269=  }
n270=  alert
n271=}   
n272=newreason if $2 != $null writeini $ul whyban $m($1) $2-
n273=;
n274=;         aliases used to shorten other things
n275=;
n276=m return $maddress($1)
n277=a1 return $address($1,1)
n278=a2 return $address($1,2)
n279=a3 return $address($1,3)
n280=a4 return $address($1,4)
n281=a5 return $address($1,5)
n282=gl return $level($m($a5($1)))
n283=al return $level($m($1))
n284=ma return $m($a5($1))
n285=thischan {
n286=  set %chans $readini $ul channels [ $rnick.nick($1) ] 
n287=  if $2 isin %chans return $true
n288=  return $false
n289=}
n290=isfriend {
n291=  if $gl($1) = 70 return $true
n292=  if $gl($1) < 19 return $false
n293=  if (%usespecific) {
n294=    if ($thischan($1,$2)) return $true
n295=    else return $false
n296=  }
n297=  return $true
n298=}
n299=isop {
n300=  if $gl($1) = 70 return $true
n301=  if $gl($1) < 40 return $false
n302=  if (%usespecific) {
n303=    if ($thischan($1,$2)) return $true
n304=    else return $false
n305=  }
n306=  return $true
n307=}
n308=isdeop {
n309=  if $gl($1) = 70 return $false
n310=  if $gl($1) != 15 return $false
n311=  if (%usespecific) {
n312=    if ($thischan($1,$2)) return $true
n313=    else return $false
n314=  }
n315=  return $true
n316=}
n317=notop {
n318=  if ($isop($1,$2)) return $false
n319=  return $true
n320=}
n321=ismyclone {
n322=  if $a3($1) iswm %myadr return $true
n323=  else return $false
n324=}
n325=ismaster {
n326=  if $gl($1) = 70 return $true
n327=  if $gl($1) < 50 return $false
n328=  if (%usespecific) {
n329=    if ($thischan($1,$2)) return $true
n330=    else return $false
n331=  }
n332=  return $true
n333=}
n334=notbot {
n335=  if ($isbot($1,$2)) return $false
n336=  return $true
n337=}
n338=notmaster {
n339=  if ($ismaster($1,$2)) return $false
n340=  return $true
n341=}
n342=notfriend {
n343=  if ($isfriend($1,$2)) return $false
n344=  return $true
n345=}
n346=isbot {
n347=  if $gl($1) = 70 return $true
n348=  if $gl($1) < 60 return $false
n349=  if (%usespecific) {
n350=    if ($thischan($1,$2)) return $true
n351=    else return $false
n352=  }
n353=  return $true
n354=}
n355=isfsban {
n356=  if $m( [ [ $1 ] $+ FileServerBan ] ) = $null return $false
n357=  return $true
n358=}
n359=fsbanreason return $readini $ul fileserverbans $replace($m( [ $1 ] $+ FileServerBan),FileServerBan,$chr(32))
n360=rnick.ady return $readini $ul nick $m($1)
n361=rnick.nick return $rnick.ady( [ $a5($1) ] )
n362=ul return $mircdiruserlist.ini
n363=convertuserlist {
n364=  ; converts pre-5.5 userlists to format used by 5.5 and above
n365=  set %num $readini $ul nicklist number
n366=  if %num = 0 halt
n367=  %i = -1
n368=  :nx
n369=  inc %i
n370=  set %nick $readini $ul nicklist [ n $+ [ %i ] ]
n371=  set %chans %usechans [ $+ [ %nick ] ]
n372=  if (%chans != $null) && (%nick != $null) {
n373=    if $chr(32) isin %chans {
n374=      %temp = ""
n375=      :again
n376=      if $chr(32) isin %chans {
n377=        set %chan $left(%chans,$calc($pos(%chans,$chr(32)) - 1))
n378=        if %temp = $null set %temp %chan
n379=        elseif (%chan !isin %temp) set %temp %temp $+ $chr(32) $+ %chan
n380=        set %chans $right(%chans,$calc(($len(%chans) - $calc($pos(%chans,$chr(32)) - 1)) - 1))
n381=        goto again
n382=      }
n383=      writeini $ul channels %nick %temp $+ $chr(32) $+ %chans
n384=    }
n385=    else writeini $ul channels %nick %chans
n386=  }
n387=  if %i < %num goto nx
n388=  unset %usechans* | altech -a 3 $+ User list converted to new format
n389=  writeini $ul version version 55
n390=}
n391=knownops {
n392=  ; if $2 = 0, return the # of recognized ops on $1
n393=  ; if $2 = 1, return the # of people opped OR in your op list on $1
n394=  %i = 0 | %num = 0
n395=  :nx
n396=  inc %i
n397=  if $nick($1,%i) != $null {
n398=    if $nick($1,%i) = $me inc %num
n399=    elseif $2 = 0 {
n400=      ; this isn't done with an "&&"... it's done in 2 lines on purpose
n401=      ; $isop may access the hard drive... dont' wanna do that unless it has to
n402=      if ($isop($nick($1,%i),$1)) inc %num
n403=    }
n404=    elseif $2 = 1 {
n405=      ; this isn't done with an "&&"... it's done in 2 lines on purpose
n406=      ; $isop may access the hard drive... dont' wanna do that unless it has to
n407=      if (($isop($nick($1,%i),$1)) || ($nick($1,%i) isop $1)) inc %num
n408=    }
n409=    goto nx
n410=  }
n411=  return %num
n412=}
n413=wordlevel {
n414=  if $1 = 15 return Deop/Devoice
n415=  elseif $1 = 40 return Op
n416=  elseif $1 = 50 return Master
n417=  elseif $1 = 60 return Bot
n418=  elseif $1 = 70 return $null
n419=  elseif $1 > 18 return Friend
n420=  else return $null
n421=}
n422=wordlevel2 {
n423=  if $1 = 15 return Deop/Devoice
n424=  elseif $1 = 40 return Op
n425=  elseif $1 = 50 return Master
n426=  elseif $1 = 60 return Bot
n427=  elseif $1 = 70 return Your Clone
n428=  elseif $1 > 18 return Friend
n429=  else return $null
n430=}
n431=wordlist {
n432=  if $1 = 15 return deop/devoice
n433=  elseif $1 = 40 return ops
n434=  elseif $1 = 50 return masters
n435=  elseif $1 = 60 return bots
n436=  elseif $1 > 18 return friends
n437=  return (?? I'm confused!)
n438=}
n439=addfsb {
n440=  ; add address $1 to file server ban list with reason $2-
n441=  set %match $m( [ [ $1 ] $+ FileServerBan ] )
n442=  if %match != $null {
n443=    set %ady $replace(%match,FileServerBan,$chr(32))
n444=    if %match = $1 altech -a %dis7 $+ $1 is already in your file server ban list!
n445=    else altech -a %dis7 $+ $1 matches an address 5,0( $+ %ady $+ ) 4,0already in your file server ban list!
n446=    if $2 = $null {
n447=      altech -a %dis8 $+ Set file server ban reason for %ady to nothing
n448=      remini $ul fileserverbans %ady
n449=    }
n450=    else {
n451=      altech -a %dis8 $+ Set file server ban reason for %ady to: $2-
n452=      writeini $ul fileserverbans %ady $2-
n453=    }
n454=  }
n455=  else {
n456=    .auser =1 $1 $+ FileServerBan
n457=    set %num $readini $ul fileserverbans number
n458=    inc %num | writeini $ul fileserverbans number %num
n459=    writeini $ul fileserverbans [ n $+ [ %num ] ] $1
n460=    if $2 != $null { 
n461=      writeini $ul fileserverbans $1 $2-
n462=      altech -a %dis9 $+ Added $1 to file server ban list
n463=      altech -a %dis9 $+ Reason: %dis8 $+ $2-
n464=    }
n465=    else altech -a %dis9 $+ Added $1 to file server ban list (no reason given)
n466=  }
n467=}
n468=realnick {
n469=  if $1 = $me altech -a %dis15 $+ duh... hey Marge, who am I?  $1 is you silly!
n470=  elseif $a3($1) iswm %myadr altech -a %dis15 $+ $1 appears to be your clone
n471=  elseif ($a3($1) != $null) {
n472=    set %nick $rnick.nick($1)
n473=    if %nick = $null { altech -a %dis15 $+ $1 ( $+ $a3($1) $+ ) is not recognized | dh }
n474=    if $1 = %nick altech -a %dis15 $+ $1 is a recognized nick
n475=    elseif (%nick != $null) altech -a %dis15 $+ $1 is really %nick
n476=    set %chans $readini $ul channels %nick
n477=    set %temp $chr(44) $+ $chr(1)
n478=    set %temp $replace(%chans,$chr(32),%temp)
n479=    set %chans $replace(%temp,$chr(1),$chr(32))
n480=    if ((%usespecific = $false) || (%chans = $null)) altech -a %dis15 $+ $1 is in your $wordlist($gl($1)) list
n481=    else altech -a %dis15 $+ $1 is in your $wordlist($gl($1)) list on %chans
n482=  }
n483=  else altech -a %dis15 $+ $1 is not in your IAL, cannot determine who it is!
n484=  alert  
n485=}
n486=lastseen set %nk $rnick.nick($1) | if %nk != $null writeini $ul seen %nk $ctime
